<template>
    <div>
        <div class="menuleft">
            <el-col>
                <el-menu :default-active="activeIndex" class="el-menu-vertical-demo"  @open="handleOpen" @close="handleClose">
                    <el-menu-item index="1">
                        <router-link to="/home">
                            <i class="icon iconfont icon-ziyuan"></i>返回首页
                        </router-link>
                    </el-menu-item>
                    <el-submenu index="2"  v-if="permissions.indexOf('公共类')>-1">
                        <template slot="title"><i class="icon iconfont icon-public"></i>&nbsp;公共类</template>
                        <el-menu-item index="2-1" v-if="permissions.indexOf('客户')>-1">
                            <router-link to="/Client">客户</router-link>
                        </el-menu-item>
                        <el-menu-item index="2-2" v-if="permissions.indexOf('供应商')>-1">
                            <router-link to="/Supplier">供应商</router-link>
                        </el-menu-item>
                        <el-menu-item index="2-3" v-if="permissions.indexOf('产品')>-1">
                            <router-link to="/Product">产品</router-link>
                        </el-menu-item>
                        <el-menu-item index="2-4" v-if="permissions.indexOf('银行')>-1">
                            <router-link to="/Bank">银行</router-link>
                        </el-menu-item>
                        <el-menu-item index="2-5" v-if="permissions.indexOf('职务')>-1">
                            <router-link to="/Duty">职务</router-link>
                        </el-menu-item>
                        <el-menu-item index="2-6" v-if="permissions.indexOf('部门')>-1">
                            <router-link to="/Department">部门</router-link>
                        </el-menu-item>
                    </el-submenu>
                    <el-submenu index="3" v-if="permissions.indexOf('财务类')>-1">
                        <template slot="title"><i class="icon iconfont icon-caiwu"></i>&nbsp;财务类</template>
                        <el-menu-item index="3-1" v-if="permissions.indexOf('会计科目类型')>-1">
                            <router-link to="/AccountSubjectType">会计科目类型</router-link>
                        </el-menu-item>
                        <el-menu-item index="3-2" v-if="permissions.indexOf('会计科目')>-1">
                            <router-link to="/AccountSubject">会计科目</router-link>
                        </el-menu-item>
                        <el-menu-item index="3-3" v-if="permissions.indexOf('预算科目')>-1">
                            <router-link to="/BudgetAccount">预算科目</router-link>
                        </el-menu-item>
                        <el-menu-item index="3-4" v-if="permissions.indexOf('现金流量项目')>-1">
                            <router-link to="/CashFlowProject">现金流量项目</router-link>
                        </el-menu-item>
                        <el-menu-item index="3-5" v-if="permissions.indexOf('预算与现金流关系')>-1">
                            <router-link to="/CashFlowProject">预算与现金流关系</router-link>
                        </el-menu-item>
                        <el-menu-item index="3-6" v-if="permissions.indexOf('预算与科目关系')>-1">
                            <router-link to="/BudgetAndSubject">预算与科目关系</router-link>
                        </el-menu-item>
                        <el-menu-item index="3-7" v-if="permissions.indexOf('辅助核算类型')>-1">
                            <router-link to="/AssistingAccountType">辅助核算类型</router-link>
                        </el-menu-item>
                        <el-menu-item index="3-8" v-if="permissions.indexOf('辅助核算项目')>-1">
                            <router-link to="/AssistingAccountProject">辅助核算项目</router-link>
                        </el-menu-item>
                        <el-menu-item index="3-9" v-if="permissions.indexOf('增值税税率')>-1">
                            <router-link to="/SalesInvoiceInformation">增值税税率</router-link>
                        </el-menu-item>
                    </el-submenu>
                    <el-submenu index="4"  v-if="permissions.indexOf('系统设置')>-1">
                        <template slot="title"><i class="icon iconfont icon-settings"></i>&nbsp;系统设置</template>
                        <el-menu-item index="4-1" v-if="permissions.indexOf('编码设定')>-1">
                            <router-link to="/EncodingSet">编码设定</router-link>
                        </el-menu-item>
                        <el-menu-item index="4-2" v-if="permissions.indexOf('系统参数')>-1">
                            <router-link to="/SysParam">系统参数</router-link>
                        </el-menu-item>
                        <el-menu-item index="4-3" v-if="permissions.indexOf('报表设置')>-1">
                            <router-link to="/ReportSet">报表设置</router-link>
                        </el-menu-item>
                    </el-submenu>
                    <el-submenu index="5"  v-if="permissions.indexOf('公告管理')>-1">
                        <template slot="title"><i class="icon iconfont icon-gonggao"></i>&nbsp;公告管理</template>
                        <el-menu-item index="5-1" v-if="permissions.indexOf('公告')>-1">
                            <router-link to="/AnnounceList">公告</router-link>
                        </el-menu-item>
                    </el-submenu>
                    
                </el-menu>
            </el-col>
        </div>
        <router-view></router-view>
    </div>
</template>
<script>
import { mapState, mapGetters } from 'vuex'
export default {
    name: "set",
    data() {
        return {
            activeIndex: "1",
        }
    },
    methods:{
        handleOpen(key, keyPath){
            console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            console.log(key, keyPath);
        }  
    },
    computed: {
            ...mapGetters({
                permissions: 'permissions'
            })
    },
}    
</script>
<style scoped>
@import '../../common/css/index.css';
</style>

